<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <titlti></titlti>
    <link rel="stylesheet" type="text/css" href="../static/plugins/jquery-easyui-1.9.15/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="../static/plugins/jquery-easyui-1.9.15/themes/icon.css">
    <script type="text/javascript" src="../static/plugins/jquery-easyui-1.9.15/jquery.min.js"></script>
    <script type="text/javascript" src="../static/plugins/jquery-easyui-1.9.15/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../static/plugins/jquery-easyui-1.9.15/locale/easyui-lang-zh_CN.js"></script>
    <script>
        $(function (){
            $('#dd').dialog({
                title: '用户修改中心',
                width: 400,
                height: 300,
                closed: false,
                cache: false,
                modal: true,
                buttons:[{
                    text:'保存',
                    iconCls:'icon-save',
                    handler: function () {
                        let isOK = $('#form').form('validate');
                        if (isOK) {
                            $.messager.confirm('确认', '是否确认修改', function (r) {
                                if (r) {
                                    SaveData('update');
                                }
                            });
                        }

                    }
                }, {
                    text: '退出',
                    iconCls: 'icon-back',
                    handler: function () {

                    }
                }]
            });
            function SaveData(action) {
                $.messager.progress();	// display the progress bar
                $('#ff').form('submit', {
                    url: '/ServletLogin?action=' + action,
                    onSubmit: function () {
                        var isValid = $(this).form('validate');
                        if (!isValid) {
                            $.messager.progress('close');	// hide progress bar while the form is invalid
                        } else {

                        }
                        return isValid;	// return false will stop the form submission
                    },
                    success: function (data) {
                        let result = eval("(" + data + ")");
                        dataType:'json'
                        if (result.code == '200') {
                            $.messager.alert('提示', result.msg, 'info');
                            $('#dd').dialog('close');
                            $('#dg').datagrid('reload');
                        } else
                            $.messager.alert('提示', result.msg, 'warning');
                        $.messager.progress('close');

                    }
                });
            }
        })
    </script>
</head>
<body style="background-image: url('../static/images/a.jpg')">
<div id="dd">
    <form id="ff" method="post">
        <table cellpadding="5">
            <tr>
                <td>用户名ID:</td>
                <td><input class="easyui-validatebox" type="text" id="id" name="id" data-options="required:true"></input></td>
            </tr>
            <td>用户名:</td>
            <td><input class="easyui-validatebox" type="text" id="username" name="username" data-options="required:true"></input></td>
            </tr>
            <tr>
                <td>原密码:</td>
                <td><input class="easyui-validatebox" type="text" id="oldpassword" name="oldpassword" data-options="required:true"></input></td>
            </tr>
            <tr>
                <td>新密码:</td>
                <td><input class="easyui-validatebox" type="text"  id="newpassword" name="newpassword" data-options="required:true "validType="equals['#password']"></input></td>
            </tr>
        </table>
    </form>
</div>
</body>
</html>
